package com.ruoyi.yljf.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.yljf.mapper.CertificatesMapper;
import com.ruoyi.yljf.domain.Certificates;
import com.ruoyi.yljf.service.ICertificatesService;

import javax.annotation.Resource;

/**
 * 证书记录Service业务层处理
 * 
 * @author metaee
 * @date 2025-04-22
 */
@Service
public class CertificatesServiceImpl extends ServiceImpl<CertificatesMapper, Certificates> implements ICertificatesService {
    @Resource
    private CertificatesMapper certificatesMapper;
    
    /**
     * 查询证书记录列表
     * 
     * @param certificates 证书记录
     * @return 证书记录
     */
    @Override
    public List<Certificates> selectCertificatesList(Certificates certificates) {
    	LambdaQueryWrapper<Certificates> queryWrapper = Wrappers.lambdaQuery();
        if (StringUtils.isNotNull(certificates.getUserId())) {
			queryWrapper.eq(Certificates::getUserId, certificates.getUserId());
		}
        if (StringUtils.isNotNull(certificates.getTargetId())) {
			queryWrapper.eq(Certificates::getTargetId, certificates.getTargetId());
		}
        if (StringUtils.isNotEmpty(certificates.getTargetName())) {
			queryWrapper.like(Certificates::getTargetName, certificates.getTargetName());
		}
        if (StringUtils.isNotEmpty(certificates.getImage())) {
			queryWrapper.eq(Certificates::getImage, certificates.getImage());
		}
        return certificatesMapper.selectList(queryWrapper);
    }
}
